package com.nacrtstudio.webgiftshop.pages.admin;

import java.util.List;

import org.apache.shiro.authz.annotation.RequiresRoles;
import org.apache.tapestry5.annotations.InjectPage;
import org.apache.tapestry5.annotations.Property;
import org.apache.tapestry5.ioc.annotations.Inject;

import com.nacrtstudio.webgiftshop.facade.Controller;
import com.nacrtstudio.webgiftshop.model.shop.PackedGift;

@RequiresRoles("admin")
public class PackedGifts {
	@Inject
	private Controller controller;
	@Property
	private PackedGift gift;
	
	
	public List<PackedGift> getPackedGifts(){
		return controller.getAllPackedGifts();
	}
	
	@InjectPage
	private PackedGiftInfo packedGiftInfo;
	
	Object onActionFromShow(Long id){
		packedGiftInfo.setPackedGift(controller.findPackedGift(id));
    	return packedGiftInfo;
    }
}
